package com.plian.system.wrapper.fr.audit;

import com.plian.system.dto.fr.audit.AuditOrganizationsDTO;
import com.plian.system.entity.fr.audit.AuditOrganizations;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.fr.audit.AuditOrganizationsVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.*;

@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface AuditOrganizationsWrapper extends BaseWrapper<AuditOrganizations, AuditOrganizationsDTO, AuditOrganizationsVO> {

    @Override
    @Mappings(value = {
            @Mapping(source = "createUser", target = "createUserName", qualifiedByName = USER_ID_TO_NAME),
            @Mapping(source = "updateUser", target = "updateUserName", qualifiedByName = USER_ID_TO_NAME),
            @Mapping(source = "principal", target = "principalName", qualifiedByName = USER_ID_TO_NAME),
            @Mapping(source = "companyNameId", target = "companyName", qualifiedByName = ORG_ID_TO_NAME),
            @Mapping(source = "approvedUser", target = "approvedUserName", qualifiedByName = USER_ID_TO_NAME),
    })
    AuditOrganizationsVO entityToVO(AuditOrganizations entity);
}
